<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>审批包租婆新增车位</title>
<link rel="stylesheet" type="text/css" href="../../css/bootstrap.min.css"> 
<script type="text/javascript" src="../../js/jquery-3.1.0.min.js" charset="UTF-8"></script>

<style type="text/css">
	#showPort{
		padding-top:140px;
		width:580px;
		margin:0 auto;
	}
	#td1{
		width:100px;
	}
	#td2{
		width:100px;
	}
	#td3{
		width:190px;
	}
	#td4{
		width:120px;
	}
	#BtnDiv{
		width:145px;
		margin:0 auto;
	}
</style>
</head>
<body>
	<div>
		<div id="showPort">
			<table class="table table-bordered">
			<thead>
				<tr>
					<th>用户名</th>
					<th>真实姓名</th>
					<th>身份证号</th>
					<th>提交时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody id="content">
			
			</tbody>
				
			</table>
		
					<ul style="position:absolute;top:300px;left:400px;" class="pager">
			<li><input type="hidden" id="ladyID"></li>
			<li><input type="hidden" id="carPortID" value="0"></li>
			<li><input type="hidden" id="pageSize" value="3"></li>
			<li><a href="javascript:void(0)" id="firstPage">首页</a></li>
			<li><a href="javascript:void(0)" id="pageUp">前一页</a></li>
			<li><label id="currentPage"></label><label>/</label><label
				id="pageCount"></label></li>
			<li><a href="javascript:void(0)" id="pageDown">下一页</a></li>
			<li><a href="javascript:void(0)" id="lastPage">末页</a></li>
		</ul>
			
		</div>
	</div>
	
</body>
<script type="text/javascript">
$(function() {
	init();
});
function init(){
	findAllUnAbelPort(1);
}
function findAllUnAbelPort(curpage){
	$.ajax({
		type:"post",
		url:"findAllUnAbelPort.do",
		data:{"curpage":curpage},
		success:function(msg){
			var content="";
			$.each(msg.list,function(i,n){
				content+="<tr><td>"+n.user.userName+"</td><td>"+n.ladyName+"</td><td>"+n.ladyCard+"</td><td>"+new Date(n.personalcarport[n.personalcarport.length-1].applyTime).toLocaleDateString()+"</td><td><a href='ensureLandladyNewPort.jsp?landladyID="+n.ladyID+"' class='btn btn-warning'> 审核</a></td></tr>"
			})
			if(msg.list.length==0){
				$("#currentPage").html(0);
			}else{
				$("#currentPage").html(msg.curPage);
			}
			
			$("#pageCount").html(msg.countPage);
		
			$("#content").append(content);
		}
	})
}
	
	
	
	//分页的四个按钮功能  方法
		$(".pager a").click	(function(){
		var curPage=$("#currentPage").html();
		var countPage=$("#pageCount").html();
		var pageFtn=$(this).html();
		
		if(pageFtn=="首页"){
			curPage=1;
		}
		if(pageFtn=="前一页"){
			
			curPage=parseInt(curPage)-1;
			if(curPage<1){
				curPage=1;
			}
		}
		if(pageFtn=="下一页"){
			
			curPage=parseInt(curPage)+1;
			if(curPage>countPage){
				curPage=countPage;
			}
		}
		if(pageFtn=="末页"){
			
			curPage=countPage;
		}
		$("#content tr").remove();
		$("#currentPage").html(curPage);
		
		findAllUnAbelPort(curPage);
			
});
</script>
</html>